package cn.yj.core.business.controller;

import cn.yj.admin.frame.AbstractController;
import cn.yj.core.business.service.i.IStatistical;
import cn.yj.entity.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 永健
 * @since 2021-06-16 09:51
 */
@RestController
@RequestMapping("/statistical")
public class StatisticalController extends AbstractController {

    @Resource
    private IStatistical iStatistical;

    @GetMapping("/user")
    public R user() {
        return success(iStatistical.userCount());
    }

    @GetMapping("/activity")
    public R activity() {
        return success(iStatistical.activity());
    }

    @GetMapping("task")
    public R task() {
        return success(iStatistical.taskCount());
    }

    @GetMapping("packages")
    public R packages() {
        return success(iStatistical.packagesCount());
    }

    @GetMapping("article")
    public R article() {
        return success(iStatistical.articleCount());
    }

    @GetMapping("product")
    public R product() {
        return success(iStatistical.productCount());
    }

    @GetMapping("/pie/article")
    public R pieArticle() {
        return success(iStatistical.pieArticle());
    }

    @GetMapping("/pie/user")
    public R pieUser() {
        return success(iStatistical.pieUser());
    }

    @GetMapping("/pie/task")
    public R pieTask() {
        return success(iStatistical.pieTask());
    }

    @GetMapping("/pie/product")
    public R pieProduct() {
        return success(iStatistical.pieProduct());
    }

    @GetMapping("/pie/packages")
    public R piePackages() {
        return success(iStatistical.piePackages());
    }
}
